docker ps -a | grep "Exited" | awk '{print $1}' | xargs docker rm

if [[ "$(docker ps -a | awk '{print $2}' | grep mysql)" != "" ]]; then
    echo "mysql is running"
else
    docker run --name hello-mysql -e MYSQL_ROOT_PASSWORD=123456 -p 3308:3306 -d mysql
    echo "mysql is starting"
fi

# docker exec -it hello-mysql /bin/bash

# mysql -u root -p123456

# ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

# CREATE DATABASE IF NOT EXISTS hello;

# use hello;

# CREATE TABLE
#     user (
#         id INT UNSIGNED AUTO_INCREMENT COMMENT '主键ID',
#         name VARCHAR(30) NULL DEFAULT NULL COMMENT '姓名',
#         age INT(11) NULL DEFAULT NULL COMMENT '年龄',
#         email VARCHAR(50) NULL DEFAULT NULL COMMENT '邮箱',
#         PRIMARY KEY (id)
#     ) ENGINE = InnoDB;

# show tables;

# select * from user;
